import {
  createRouter,
  createWebHistory,
  createWebHashHistory,
} from "vue-router";

const routes = [
  {
    path: "/",
    redirect: "login",
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/page/login/login.vue"),
    meta: {
      // keepAlive: true,
    },
  },
  {
    path: "/home",
    name: "home",
    component: () => import("@/page/home/home.vue"),
    meta: {
      keepAlive: true,
    },
  },
  {
    path: "/newsUpDown",
    name: "newsUpDown",
    component: () => import("@/page/newsUpDown/index.vue"),
    meta: {
      keepAlive: true,
    },
  },
];

// 导出路由
const router = createRouter({
  history: createWebHashHistory(), //开启hash模式
  routes,
});

export default router;
